#!/bin/bash

web=buff.html
goods=goods.txt
name_t=name.txt
name='abc'
goodid=$1

echo "$goodid"
while :
do
shijian=`date +%Y年%m月%d日%H:%M`
cat /dev/null >$goods
curl https://buff.163.com/goods/$goodid >$web
grep -E -o data-goods-name=\".\{1,30}\" $web |sed '2,$d' |cut -b 17-80 |sed s/[[:space:]]//g >$name_t

name=$(cat $name_t)
echo $name
touch data/$name.csv #创建单个饰品的文件
chmod a+x data/$name.csv

grep -E -o data-goods-sell-min-price=\"\[0-9]\{0,10}\" $web |sed '2,$d' |cut -b 28-90 |sed 's/"//g'>$goods
cat $goods
echo "$shijian  $(cat $goods)" >>data/$name.csv

cat /dev/null >$goods
sleep 10m
done